Option Strict Off
Option Explicit On
Friend Class Campaign
	Inherits System.Windows.Forms.Form
	
	Public scenario_selected As Short
	
	Dim scenario_titles(100) As String
	Dim scenario_descriptions(100) As String
	Dim scenario_goals(100) As String
	Dim scenario_passwords(100) As String
	Dim num_scenarios As Short
	
	Private Sub cmdPickCards_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdPickCards.Click
		PickActions.Show()
	End Sub
	
	Private Sub cmdStart_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdStart.Click
		Me.Hide()
		game.Show()
		Call game.start_game()
	End Sub
	
	Public Sub unlock_scenario(ByVal i As Short)
		If i > get_max_scenario Then
			FileOpen(1, My.Application.Info.DirectoryPath & "/campaign.txt", OpenMode.Output)
			PrintLine(1, scenario_passwords(i - 1))
			FileClose(1)
		End If
	End Sub
	
	
	Public Sub Campaign_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
		Dim max_scenario As Object
		Dim i As Short
		'UPGRADE_NOTE: str was upgraded to str_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"'
		Dim password As Object
		Dim str_Renamed As String
		num_scenarios = 18
		
		scenario_titles(0) = "Chapter 1, Part 1: Rags to Riches"
		scenario_descriptions(0) = "All your life you have scrapped by a meager existance working in the bakery that has been passed down from generation to generation.  Last month, the Duke of Egnor announced higher taxes to fund his latest territorial war.  While the extra taxes meant less food for you to eat, you managed to survive, aliet just barely.  Then last week the more troubling news came: you had been drafted to fight in the Duke's army.  Instead of choosing to fight for that tyrant, you decide to make a run for it.  With not even a single copper to your name, you leave your shop and run through the village trying to accumulate some cash to make your escape."
		scenario_goals(0) = "Accumulate at least 45 coins worth of Treasure before the game ends."
		scenario_passwords(0) = "sdlfg"
		
		scenario_titles(1) = "Chapter 1, Part 2: Battle with the Bandits"
		scenario_descriptions(1) = "You have escaped from the duchy guard with your pockets loaded with treasure.  As you consider your next steps, you realize that you are never safe as long as the Duke of Egnor still rules this land.  With your new-found riches, perhaps you can plot to overthrow the Duke!  You head to a nearby town to spend your money on necessary supplies, but you are ambushed by a pack of thieves.  Can you escape their clutches alive?"
		scenario_goals(1) = "Purchase a Province.  You lose if you have no Treasure cards left."
		scenario_passwords(1) = "scvokp"
		
		scenario_titles(2) = "Chapter 1, Part 3: Territorial Feud"
		scenario_descriptions(2) = "Your first step towards overthrowing the Duke is complete: you have acquired a Province of your own.  Unfortunately, the thieves left you nearly broke, so you were forced to sell your province to one of the local nobility.  In exhange for your Province you got a mere 7 Copper and 3 Estates.  Worst of all, your transaction did not go unnoticed by the other nobles in the area.  Not wanting to have their own territorial claims challenged, a group of nobles decides to deal with you right now.  Show them that you will not be subdued by expanding your empire even further."
		scenario_goals(2) = "Acquire more victory points than your opponents."
		scenario_passwords(2) = "as;onmnk"
		
		scenario_titles(3) = "Chapter 1, Part 4: Leader of the Land"
		scenario_descriptions(3) = "By expanding your empire in the face of opposition, you have asserted your authority over the lesser nobility of Egnor.  You explain to them your plan to overthrow the Duke, and give them the option of supporting your plan now.  To a man they agree.  Emboldened by your newly-formed alliance, you continue your march to the Duke's mansion.  When you arrive, you attempt to lead a rally cry to intimidate the Duke.  But when you look around, you see that your allies have fled.  Apparently their 'support' just meant that they would not interfere with your plans.  Unphase by this duen of events, you press on and come face to face with the Duke.  Your duel begins."
		scenario_goals(3) = "Acquire more victory points than Duke Egnor.  He begins with 4 Duchies."
		scenario_passwords(3) = "6+5+4"
		
		scenario_titles(4) = "Chapter 2, Part 1: Wanderlust"
		scenario_descriptions(4) = "Having overthrown the Duke, you are now the leader of Egnor.  Remembering the reason you started this whole mission, you call off your foreign wars and bring home your troops.  You disband your army.  As your popularity grows, however, your coffers shrink.  If you cannot gain riches through conquest, perhaps you can do so through trade.  You decide to build a fleet of new ships and explore the lands outside of Egnor."
		scenario_goals(4) = "Build at least 12 ships before the game ends."
		scenario_passwords(4) = "kjsdkjsdk"
		
		scenario_titles(5) = "Chapter 2, Part 2: Attack at Sea"
		scenario_descriptions(5) = "Having amassed a giant fleet, you set out across uncharted waters in search of new lands.  Along the way you are constantly beset by pirates, but you are able to fend them off, though at a cost.  When you finally manage to spot land -a chain of uninhabited islands-, you realize that the earlier battles were just the beginning.  The pirates have massed together to take you down and claim the contents of your holds.  Defeat is inevitable, but perhaps you can stash away some of your treasure before being captured."
		scenario_goals(5) = "Hide Gold on 3 different Islands"
		scenario_passwords(5) = "asfsdhg"
		
		scenario_titles(6) = "Chapter 2, Part 3: Ship of the Dead"
		scenario_descriptions(6) = "As the pirates decend upon your flag ship, a black cloud crosses the sky, bringing with it a deep mist.  Without explanation, the bucaneers turn away and raise the masts for maximum speed.  The reason soon becomes clear, though, as another ship pulls alongside yours.  A black ship.  A ghost ship.  Although you alone will survive this encounter, your will never be the same.  And you will never, ever be able to speak to another man about the horrors that you witnessed on that ship of death."
		scenario_goals(6) = "Barely survive by having at least -10 VPs at the end of the game."
		scenario_passwords(6) = "plmhtfxsq"
		
		scenario_titles(7) = "Chapter 2, Part 4: Rescued"
		scenario_descriptions(7) = "For reasons you will never understand, the evil ship of the danmed has released you from its clutches.  You find yourself on the beach of an unknown island, with your battered ship washed up nearby.  While others might despair at this situation, you see the opportunity in everything.  After all, you have reached a foreign land full of great wonders.  Wasn't that your original goal?  You will need a new crew to make it back to Egnor, but perhaps the natives will be willing to help?  Then again, maybe not..."
		scenario_goals(7) = "Gather 1 of every Kingdom Card under a Native Village."
		scenario_passwords(7) = "pumpkin"
		
		scenario_titles(8) = "Chapter 3, Part 1: Limited Resources"
		scenario_descriptions(8) = "Your fill the holds of your lone ship to capacity and set back upon the voyage home.  The treasures and novelties you are bringing with you will surely increase your forture, power, and devotion from your subjects.  Having just a single ship, you are completely ignored by pirates and other treacheries of the open sea.  You are also blessed with good weather, so you arrive back to your homeland without incident.  Before announcing your return, you decide to walk through the market incognito to get a feel for the mood of the land.  It is not good.  People are frenzied, and the amount of wares available are scarce.  As soon as items become available they are gone again!  What is going on?"
		scenario_goals(8) = "Adapt to the situation by accumulating the most VP."
		scenario_passwords(8) = "sghhiohwhwhwhw"
		
		scenario_titles(9) = "Chapter 3, Part 2: Share the wealth"
		scenario_descriptions(9) = "After a few hours of competing for resources at the market, everything is gone and you are exhausted.  You adjourn to the nearest inn and stir up a conversation with the locals.  You discover that in your absense, the lesser nobles have not ruled well.  Through their petty infightning and self-indulgences, they have stripped your land of all gold and broken it up into several smaller territories.  You will surely deal with them later, but for now you must stabilize the situation among the commoners.  Your first step is to go to your ship and unload the wares.  You decide to share your loot with everyone, in the spirit of generousity."
		scenario_goals(9) = "Make sure each other player's deck is at least 35 cards at the end of the game.  You can choose your own 8 kingdom cards by using the 'Pick Cards' screen"
		scenario_passwords(9) = "lalalalalalallss"
		
		scenario_titles(10) = "Chapter 3, Part 3: Regaining Control"
		scenario_descriptions(10) = "The people of your land once again begin to prosper thanks to your intervention, and order is being restored.  It is now time to settle matters with the nobility once again.  This time, though, you are at a bit of a disadvantage.  They have hoarded all the available gold, while you are resource-starved.  Somehow, you must still find a way to show them that you are still the leader, and that they are the subservients."
		scenario_goals(10) = "Accumulate the most VP.  The nobles will start with Gold instead of Copper.  You can choose your own 10 Kingdom Cards."
		scenario_passwords(10) = "kjsdkjsdkbbthf"
		
		scenario_titles(11) = "Chapter 3, Part 4: Egnor Reunited"
		scenario_descriptions(11) = "Once again the nobles go slithering off back to their Estates while you have asserted your authority over them.  You realize that this cycle will continue forever, though, unless you do something about it once and for all.  It is time to claim all of the Estates of Egnore and the surrounding lands into your own Province.  You will meet resistance no doubt, but you will not be stopped.  You will conquer each estate one-by-one, vanquishing their former leaders as your do."
		scenario_goals(11) = "Collect at least 20 Estates.  Each opponent must end the game with at least 1 Curse, and more Curses than you.  You may choose 5 of the 10 Kingdom Cards."
		scenario_passwords(11) = "kjsdkjsggdk"
		
		scenario_titles(12) = "Chapter 4, Part 1: Adventures Abroad"
		scenario_descriptions(12) = "Egnor is once again firmly under your control.  Your province is well-supplied and your people are happy.  Yet you are not.  You are filled with an ambition completely unknown to you in your baker days.  One provice is not enough, you must have more!  You have come to the realization that trade with foreign empires is not enough; you must rule them all.  You prepare your fleet and return first to the village on which you were shipwrecked.  As you come guns blazing, however, the natives do not offer you such a warm reception this time."
		scenario_goals(12) = "Assert your dominance by acquiring 5 Provinces."
		scenario_passwords(12) = "llama"
		
		scenario_titles(13) = "Chapter 4, Part 2: Machinations"
		scenario_descriptions(13) = "One new province conquered, so many to go!  As you look for new territories, you soon discover the kingdom of Asmodius.  The people here are too well-armed to overrun with force, so you are forced to use more subtle means.  You plan to repeat your takeover of Egnor by first gathering supplies and then building a group of minions to do your bidding.  However, customs are strange here, and you are not able to barter with your usual efficiency.  Establishing a foothold will not be easy"
		scenario_goals(13) = "Accumulate the most VP.  All supply cards cost you 1 extra to buy."
		scenario_passwords(13) = "notallama"
		
		scenario_titles(14) = "Chapter 4, Part 3: Everyone has his Price"
		scenario_descriptions(14) = "You have finally become familiar with the way of these people.  Commerce is everything in Asmodius, and you have become the merchant king.  The time has come to translate your ecomonic power into political power.  You meet with King Asmo and try to arrange a deal.  To your surprise, the king is quite accomodating.  He is willing to simply sell you all of his land... but at twice the cost that he paid for it.  A fair deal, you think."
		scenario_goals(14) = "Accumulate the most VP.  Victory cards cost you double to buy.  You can choose your own 10 Kingdom Cards."
		scenario_passwords(14) = "polarbear"
		
		scenario_titles(15) = "Chapter 4, Part 4: Shangrala"
		scenario_descriptions(15) = "Your journies continue and more kingdoms become yours.  After over a decade of travel, battle, and shrewd negotiating, you finally obtain the ultimate title: Emperor of the World!  And again, you should be satisfied, but you are not.  Rumors of a utopian island circulate, and you will not rest until that too, is within your grasp.  Expending enormous resources, you finally get a report that the island has been found.  You immediately board your fastest vessel and sail to this mythical land to see if it is really as amazing as the legend suggests."
		scenario_goals(15) = "Explore the island, and gain at least 75 VP."
		scenario_passwords(15) = "hungryhippo"
		
		scenario_titles(16) = "Chapter 4, Part 5: Paradise Found"
		scenario_descriptions(16) = "This amazing island, which you have decided to name 'Isle de " & settings.txtName(0).Text & "', truly has lived up to its legend.  However, it is extremely remote, and you find it difficuly to maintain your iron grasp on the rest of the world from your island paradise.  Though it will be a massive undertaking, you will exhaust your remaining resources to build a bridge from this island to the nearest land mass several hundred miles away.  This architectural feat will go down as a wonder of the world, if only you manage to complete it..."
		scenario_goals(16) = "Construct enough Bridges to reduce the cost of a Province to exactly 1 before you die of old age (turn 30).  You can choose your own 10 Kingdom Cards."
		scenario_passwords(16) = "almostdone"
		
		scenario_titles(17) = "Chapter 4, Part 6: The Final Battle"
		scenario_descriptions(17) = "Against all odds, your bridge is complete.  The unlimited resources of  'Isle de " & settings.txtName(0).Text & "' are yours for the taking.  In your old age, you reflect that perhaps you have in some ways become the evil ruler that your originally overthrew.  While you have tried to keep your people happy, you have also exhausted so many resources in pursuit of your quests.  It is time to finally repay the people, by making your island public to everyone.  Lest they forget who is the emperor, though, you will still maintain control by keeping the majority of the resources for yourself. "
		scenario_goals(17) = "Accumulate more VP than all your opponents combined.  You can choose your own 10 Kingdom Cards."
		scenario_passwords(17) = "alldone"
		
		scenario_titles(18) = "Campaign Complete"
		scenario_descriptions(18) = "With access to the legendary 'Isle de " & settings.txtName(0).Text & "' granted to the public, the entire world is prosperous.  You, as its leader, are finally satisfied, and can rest in peace.  "
		scenario_goals(18) = "Congratulations, you have completed Campaign Mode.  The 'Envoy' card is now available to use."
		
		
		'UPGRADE_WARNING: Couldn't resolve default property of object get_max_scenario. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		'UPGRADE_WARNING: Couldn't resolve default property of object max_scenario. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		max_scenario = get_max_scenario
		comboScenario.Items.Clear()
		'UPGRADE_WARNING: Couldn't resolve default property of object max_scenario. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		For i = 0 To max_scenario
			comboScenario.Items.Add((scenario_titles(i)))
		Next i
		'UPGRADE_WARNING: Couldn't resolve default property of object max_scenario. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		comboScenario.SelectedIndex = max_scenario
		Call comboScenario_SelectedIndexChanged(comboScenario, New System.EventArgs())
	End Sub
	
	Public Function get_max_scenario() As Object
		' find out what the max scenario is
		'UPGRADE_NOTE: str was upgraded to str_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"'
		Dim str_Renamed As String
		Dim i As Short
		
		'UPGRADE_WARNING: Couldn't resolve default property of object get_max_scenario. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		get_max_scenario = 0
		'UPGRADE_WARNING: Dir has a new behavior. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"'
		If Dir(My.Application.Info.DirectoryPath & "/campaign.txt") <> "" Then
			FileOpen(1, My.Application.Info.DirectoryPath & "/campaign.txt", OpenMode.Input)
			Input(1, str_Renamed)
			For i = 0 To num_scenarios - 1
				If str_Renamed = scenario_passwords(i) Then
					'UPGRADE_WARNING: Couldn't resolve default property of object get_max_scenario. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					get_max_scenario = i + 1
				End If
			Next i
			FileClose(1)
		End If
	End Function
	
	'UPGRADE_WARNING: Event comboScenario.SelectedIndexChanged may fire when form is initialized. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="88B12AE1-6DE0-48A0-86F1-60C0686C026A"'
	Private Sub comboScenario_SelectedIndexChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles comboScenario.SelectedIndexChanged
		lblDesc.Text = scenario_descriptions(comboScenario.SelectedIndex)
		lblGoal.Text = scenario_goals(comboScenario.SelectedIndex)
		scenario_selected = comboScenario.SelectedIndex + 1
		If scenario_selected = num_scenarios + 1 Then
			cmdStart.Visible = False
		Else
			cmdStart.Visible = True
		End If
		
		If scenario_selected > 9 And scenario_selected <> 13 And scenario_selected <> 19 Then
			cmdPickCards.Visible = True
		Else
			cmdPickCards.Visible = False
		End If
		
	End Sub
	
	Private Sub Campaign_FormClosed(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
		End
	End Sub
End Class